/* 
 * File:   OpenglWindow.h
 * Author: Marco Ambu
 *
 * Created on September 30, 2010, 6:26 PM
 */

#ifndef _OPENGLWINDOW_H
#define	_OPENGLWINDOW_H

#include "OpenglShape.h"
#include "ReshapeHandler.h"
#include "DisplayHandler.h"
#include "KeyboardHandler.h"
#include <string>
#include <vector>

class OpenglWindow : public ReshapeHandler, public DisplayHandler, public KeyboardHandler
{
public:
  OpenglWindow();
  // named ctors
  OpenglWindow& setTitle(const std::string& title);
  OpenglWindow& setWidth(std::size_t width);
  OpenglWindow& setHeight(std::size_t height);
  OpenglWindow& setDoublebuffer(bool use);
  OpenglWindow& setCurrentRotation(int x, int y);

  void create();  // create the window befor adding shapes

  void addShape(const OpenglShape& shape);

  // implements Handler intf.
private:
  virtual void onReshapeEvent(int width, int height);
  virtual void onDisplayEvent();
  virtual void onKeyEvent(unsigned char key, int x, int y);
  virtual void onSpecialEvent(int key, int x, int y);
  
private:
  std::string title_;
  std::size_t width_;
  std::size_t height_;
  bool useDoublebuffer_;
  int currentRotationX_;
  int currentRotationY_;
  std::vector<unsigned int> callList_;
};

#endif	/* _OPENGLWINDOW_H */

